package com.mzj.saas.mservice.lockManager.repository;

import com.mzj.saas.mservice.lockManager.entity.LockVersion;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

public interface LockVersionRepository extends PagingAndSortingRepository<LockVersion, Long>, JpaSpecificationExecutor<LockVersion> {
    @Modifying
    @Query(value = "UPDATE `saas_lock_version` v SET v.status=?2 WHERE v.`id` = ?1", nativeQuery = true)
    int updateStatus(Long id, int status);

    List<LockVersion> findByBrandIdAndStatus(Long brandId, Integer status);

}
